#ifndef GLOBAL_H
#define GLOBAL_H

#define DEBUG

#define FILEPATH "/srv/Girl/www"
#define DEFAULT_PAGE "index.html"

#define gettid (int)syscall(SYS_gettid)

#define __FILENAME__ (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1):__FILE__)

/******************************DEBUG_LOG******************************************/
//#define _DEBUG_LOG

#ifdef _DEBUG_LOG
#define DEBUG_LOG(format, ...) \
{ \
printf("[TID:%d]\t%s\t%d\t" format"\n", gettid,  __FILENAME__, __LINE__, ##__VA_ARGS__ ); \
}
#else
#define DEBUG_LOG(format, ...)   
#endif //DEBUG_LOG
/******************************End DEBUG_LOG***************************************/

/******************************ERROR_LOG*******************************************/
//#define _ERROR_LOG

#ifdef _ERROR_LOG
#define ERROR_LOG(format, ...) \
{ \
printf("\e[0;31m[TID:%d]\t%s\t%d\t%s\t" format"\e[0;31m \e[0m \e[0m\n", gettid,  __FILENAME__, __LINE__, strerror(errno), ##__VA_ARGS__); \
}
#else
#define ERROR_LOG(format, ...)   
#endif //ERROR_LOG
/******************************End ERROR_LOG***************************************/

#endif //GLOBAL_H
